Clues to fossil mammals' diets come from teeth,skull shape,
from fossil dung and gut contents, from lab analysis of oxygen isotopes in bone and teeth,
and by looking at diets of similar modern animals.
High crowned (hypsodont) capybara teeth suggest a plant diet largely focused on grasses
Like modern capybara, extinct capybara were probably selective grazers, or mixed feeders, at times probably consuming more plant species than merely grasses.
Rear-most molars are tallest; capybaras chew most effectively in rear of mouth (Koenigswald et al 1999)
High crowned teeth in capybara and other grazers, notes MacFadden (1997), have traditionally been assumed to have evolved along with development of widespread grasslands, but some researchers suggest grit from the soil drove this evolution.
New studies of a rare early mammal from Argentina suggest high crowned teeth didn't always evolve along with abrasive grasses; this trait appeared much earlier in some groups, before grasslands were major biomes world-wide. ( Koenigswald et al 1999)
Koenigswald et al (1999)
MacFadden (1997)