Rolling masks a dog's scent, allowing them to sneak up on prey. It's an instinct from their wild ancestry.
Dogs roll in smelly stuff simply because they like the way it smells. It's a way to get attention.
The texture and coolness of grass likely feels pleasing against a dog's back when they roll.
Rolling and rubbing may help dogs relieve anxiety, excitability, and nervous energy.
Dogs learn that rolling gets a reaction from their owners, even if it's negative attention.
If happening frequently, grass rolling may indicate an underlying skin allergy or condition. See your vet.
Distract them into another behavior when they try to roll. Avoid scolding or yelling.