Berachos, chapter three, mishnah two. The mishnah continues to deal with those who accompany the deceased. It states: "Kavru es hameis vechazru" - after burying the deceased, they would return immediately from the burial itself, as is our custom, to what is called 'the row', the row in which the mourners are comforted.
"Im yecholin lehaschil ulegmor ad shelo yagi'u lashurah":
They buried the deceased, and now they are on their way back to the row. If they are able to begin Shema and finish it before they reach the place where the row will be formed for comforting the mourners - "yaschilu", they should begin. "Ve'im lav - lo yaschilu" - if they cannot finish within that short span of time, they need not begin.
"Ha'omdim bashurah":
At a very large funeral, where many people come to comfort, only those standing on the inside will actually be able to comfort the mourners; those standing behind them have no direct contact with the mourners. From here the mishnah draws a distinction:
"Hapenimiyim peturim" - those standing in the inner row are exempt from Shema, because they are actively involved in the mitzvah of comforting mourners.
"Vehachitzonim chayavim" - those standing in the outer rows are obligated in Shema, since they are unable to comfort the mourners directly.
In summary: in this mishnah we learned the law of those returning from the burial to the row - if they can begin and finish Shema before they reach the row, they should begin, and if not, they should not begin; and the law of those standing in the row itself - the inner ones, who are actually engaged in comforting, are exempt, while the outer ones, who are not comforting directly, are obligated.