There are places I ride where it is unacceptable to snack. There are places where I allow it. Down in the riverbed, the trails are narrow and the food abundant, my rule is, if the horse continues at the pace I tell her, and does not turn her face more than a few degrees in either direction to eat, I won't argue. But if she stops, turns or otherwise tells me that she is going to do this regardless, she gets reminded. First time, a little nudge, second time, tell her (I kick her side) and lastly, I take her head back -- with one rein. If you are in a power struggle with two reins, you will lose. One rein has more power. Last resort, I will loop the reins around the saddle horn to prevent her and save my hands (at a stop of course.)
BUT: the Biblical answer is:
“You shall not muzzle an ox when it is treading out the grain." )(Dt 25:4) What that means is, if the animal is working hard for you, you give leeway. If it is just a "I wanna", and you know not a hunger issue, then take control.
One last point: There are some plants on the trail that are not good for the horses to eat. Fiddlers Neck, here in CA is being sown by fire retardants during wildfire season and makes the horses sick, even can make them die. Oleander is ubiquitous in So. Cal. Horses raised in controlled environments might not have the instinct to avoid the poisons. It is up to the rider to be aware and to take control