Rats in the wild eat everything from grass and grain to soap and wire! In the Middle Ages, rats basically stole grain from sacks left in alleyways.
As pets, they eat pellets and fruits (grapes, cherries, even). They may like edible hidehouses (hint: honey flavored wood ones sold in pet stores are great for rats and Guinea pigs!) and even your hair. But don't let them eat your hair.... They could get hairballs!