Hypsodont (i.e. high-crowned) teeth have been interpreted as an indicator of feeding preferences and habitat selection in ungulates. For this reason, the degree of hypsodonty has been used for estimating the diet of ancient taxa and in palaeoenvironmental reconstructions. The goal of this study is to elucidate the relative importance of grass consumption and open habitat foraging in the development of hypsodont teeth, using novel computer techniques of knowledge discovery applied to a dataset of 134 species of artiodactyls and perissodactyls distributed among thirteen families. The results obtained suggest that high-crowned teeth represent an adaptation for feeding in an open habitat, although the minimum threshold of hypsodonty seems to increase with the relative length of the anterior part of the jaw. On the contrary, there is no direct relationship between the degree of hypsodonty and the percentage of grass consumed, except for the correspondence between grazing and dwelling in open habitats. A relatively wide muzzle evidences an adaptation for grass foraging in open and mixed habitats, but there are some non-grazing species from a closed habitat that also show wide muzzles. Thus, the hypsodonty index, combined with the length of the anterior part of the jaw and the width of the muzzle, allows accurate inferences on the ecological preferences of extinct ungulates.