Eating plants is hard work. I'm not making some kind of statement about going vegetarian, but I'm saying that from a nutritional and biomechanical standpoint, being an herbivore is a difficult proposition, and not many vertebrate groups have managed to do it efficiently. Interestingly, the ones that have have all done it in slightly different ways.
There are a few problems with eating plants. First off, plant cells have tough cell walls made of cellulose that are hard to break down. To do so you need to either dissolve them chemically, or physically break it down. Also, plants aren't particularly nutritious, especially the leafy parts, so an animal that is going to survive on leaves needs to eat a lot of plant material to get sufficient energy and nutrients. If you're eating grass you have the extra difficulty of dealing with its abrasiveness. Grass often has phytoliths - small bits of hard silica - within its various structure. In addition, being close to the ground means that it's usually covered with grit and dirt which add to the abrasion.
Despite all of this, herbivory has been a successful mode of life for many vertebrates. Mammals have evolved the most herbivorous, but there are herbivorous lizards and birds, and even an herbivorous frog. The way to deal with plant material varies among the groups, but there are two different paths (which can be combined) - breaking down the plant matter physically, or breaking it down chemically with the help of microbes that can eat the cellulose.
The first path - physical breakdown - usually involves chewing. Counterintuitively, chewing is a relatively rare thing in the animal kingdom. Most vertebrates just bite off a piece of whatever they are eating, usually meat, and swallow it whole. A crocodile or snake won't chew on you, the former eats you in bits, and the latter eats you (or more probably a mouse) whole. Mammals are the kings of chewing. One of the key adaptations of mammals (and the defining character of the group) is a new jaw joint that allows for chewing and the helps resist the high forces associated with mastication. In addition, mammal teeth occlude precisely. This means that the cusps, blades, and ridges of the upper and lower teeth match up, so that during the chewing motion they move against one another, facilitating the physical breakdown of food.
Birds don't have teeth, but are still able to physically breakdown plant matter because they have a unique organ, the gizzard, just for this purpose. The gizzard is a muscular part of the stomach that some birds use as a processing center for food. Small rocks and grit are swallowed, the the muscular walls of the gizzard grind the food with the rocks, aiding digestion. Birds actually aren't the only animals with a gizzard. All archosaurs have or had them, so that means crocodiles, alligators, and dinosaurs were at least pre-adapted for plant eating, although not all of them did (or do) eat plants. Some invertebrates have gizzards too, like earthworms. We sometimes find evidence of fossil gizzards as gastoliths (literally "belly stones") within the remains of some dinosaurs.
Gastroliths in the belly of a Psittacosaurus
Speaking of dinosaurs, at least one group of them evolved a chewing mechanism similar to mammals, but different in some key ways. In most mammals, the lower jaw moves side-to-side relative to the upper jaw to provide the grinding action necessary to break down plant matter. A few mammals (some rodents and elephants) have lower jaws that move front-to-back to grind, but in both cases it's the lower jaw doing the work. Ornithopod dinosaurs (which include the 'duck-bills' that most people are familiar with) only moved the lower jaw up and down, and it was the upper teeth that moved to grind food. This is because dinosaurs, like many other vertebrates (except mammals) have kinetic skulls, meaning that there are movable joints in the cranium. This allowed the upper teeth to move side-to-side relative to the lower teeth (the action is actually more complex than I'm describing, but that's close enough). This demonstrates different solutions to a similar problem due to different ancestries (aka phylogenetic constraint)!
A comparison of the jaws of horses and hadrosaurs showing the different jaw movments.
Chemical breakdown of plant material is called gut fermentation. In this strategy, animals have large guts filled with symbiotic bacteria which aid in the breakdown of the tough cellulose of plants. There are different ways of doing gut fermentation, but they all leave a characteristic skeletal signature - barrel-shaped thoraxes and abdomens to accomodate the fermentation chamber. Gorillas are a good example of this; their huge bellies are basically big fermentation vats for breaking down the leaves that they eat. Ruminants are a group of hoofed-animals that have taken this to the extreme, with their 4-chambered stomachs and assembly-line breakdown of food. They even add an extra physical breakdown step by chewing their cud - moving partially digested food from the stomach back to the mouth for a second round of mastication.
We can infer from the basic body shapes of extinct animals that they too may have had similar internal factories for plant breakdown. Ceratopsian dinosaurs had wide barrel-shaped bodies, as did other dinosaur groups like ankylosaurs and sauropods. Certainly extinct relatives of modern gut-fermenters had similar anatomies. There are actually a number of different types of gut-fermentation, and the benefit of one over another may have been a contributing factor in why some groups out-competed others, but that's a story for another time (the punchline is that there is a reason why there are far less horse-relatives than cow-relatives...).
Like I said at the beginning, eating plants is hard, but there are ways to accomplish it and be ecologically and evolutionarily successful. If you can do it, and do it well, the world is yours. Plants are everywhere, and they are easy to 'catch' - just walk up and eat them. The key is what you do then, and a number of vertebrate groups have solved this in different ways over the course of their history.