Well, actually it's a bit more complicated than that.
Cows (and cattle) eat a variety of plants, including various grasses, however they also eat a variety of forbs or broad-leafed plants. Cows will also eat various tree leaves and shrubs, if they're tasty.
Cows that are on pasture usually have a lot more to select from than when they're confined in a barn or dirt corral. Cows on pasture that have access to different grasses, forbs, trees, and shrubs will eat what they find palatable--or tasty--and leave those that they don't like. What kind of various plant species that cows will eat ultimately depends on where you are located when reading this. Some examples include dandelion, brassicas (such as turnip and radish tops), clover, alfalfa, trefoil, most grasses (brome grass, ryegrass, wheatgrasses, fescues, etc.), the occasional sorrel and kochia, and even some plants in the carrot/parsnips family, like carrot tops. Cows, as herbivores, love a wide variety of plants to choose from, especially when these variety of plants contain various quantities of nutrients that may meet their nutritional cravings, to some extent.
Cows in confinement aren't so lucky. They receive what farmers and nutritionists call a "total mixed ration" (TMR) of specific plant foods that humans have specifically chosen for them to eat, based on availability (what's grown locally, or what can be shipped regionally at a reasonable cost), and what the human element expects to get out of the animals.
Most TMRs are a combination of silage (pickled or fermented fodder), hay (sun-cured/dried fodder), and grains, with a specialty mineral mixture thrown in.
Dairy cows raised in conventional milking operations often get a TMR of alfalfa-grass hay (high quality grasses such as orchard grass, ryegrass, timothy, fescue), silage (typically corn silage, or barley silage), and grains (mix or selected corn or barley, occasionally oats, rye, or wheat may also be added or substituted). Such rations are primarily hay and silage (60 to 80%), and less grain (20 to 40%).
Finisher cattle, or those raised conventionally for beef, are on TMRs of little hay, mostly silage and plenty of grain. By the time cattle are close to ready for slaughter, they are on 85 to 90% grain (primarily corn or barley), and 10 to 15% silage (corn or barley). They are also supplemented with a high-calcium mineral mixture.
The Bovine Practicum Q&A "blog" is an informative, just-for-fun section where I find a variety of questions that are often (and not-so-often) asked by inquisitive people like you, and answer them to the best of my ability. Much of the questions have come from a wide variety of reaches from the Internet.
Popular topics include: Cows, feeding, breeding, beef, slaughter, calves, dairy, milking, breeds, grazing, bulls, feeds, and much more!