Why do people rip out grass upon leaving the cemetery?

The Custom of Tearing out some Grass when Leaving a Cemetery

There is a custom of tearing some grass out of the ground and throwing it over one’s shoulder when leaving a cemetery, while saying the passuk (verse), “Yatzitzu mei’ir k’eisev ha’aretz” (They will sprout forth like grass from the ground), or, “Zachur ki afar anachnu” (Remember, Hashem, that we are merely dust). This practice is repeated three times. Some only do this when returning from a funeral, although the common custom is to do it every time one leaves a cemetery. However, this should not be done on chol ha’moed, and obviously not on Shabbos or Yom Tov.

The following are some of the reasons for this custom:

It’s an expression of our tza’ar (anguish) over the ones who have passed away.

It serves as a reminder of the yom hamisah (the impending day of one’s death).

The act of tearing grass from the ground with the awareness that it will inevitably grow back serves as a symbol and reminder of techiyas hameisim (the future resurrection of the dead).

This practice involving grass alongside that of washing one’s hands upon leaving a cemetery is symbolic of the process for purifying those who had come in contact with a dead body in the times of the Beis Hamikdash (Holy Temple) and some time thereafter; the ashes of the parah adumah (red heifer), which were used for purification, were mixed with spring water and sprinkled on the impure individual using a sprig of grass. #506?1

https://halacha2go.com?number=506

Practical Halacha: One minute a day. By Horav Yosef Yeshaya Braun, shlita, Mara D'asra and member of the Badatz of Crown Heights.