You see it as a trail surrounded by plentiful vegetation. To your horse it's a sumptuous smorgasbord just begging to be sampled. Allowing him to eat while you're riding can help ease any anxiety he may have about the trail. It can also increase his enjoyment of the outing. But if he's more intent on snacking than he is on responding to your aids, it's time to refocus his attention.
He won't be as easily distracted if his grazing time at home is sufficient and he's consuming adequate forage. More hours at pasture—with a corresponding cutback in concentrates—will allow him to maintain his weight as he satisfies his natural desire to graze and fill his belly with forage. If, however, your pasture is poor or your horse at risk for laminitis, feed quality grass hay as the bulk of his diet.
Another way to prevent his focus from straying is to remain aware of your surroundings and maintain communication with your horse through your aids. A trail ride is meant to be relaxing and fun, but it's essential that your horse listen to you. Apply hand and leg aids as you would in the arena. Try a shoulder-in to pass a tempting bush or extend your walk through a grassy patch.
If your horse still grabs the occasional branch, you may decide it's best to ignore him. As long as he continues to respond to your aids, a snack here and there on the trail should do him no harm—assuming he's eating nontoxic vegetation. You may even want to incorporate grazing stops into your ride.