Grasslands cover more than 20% of the Earth's terrestrial surface, and their rise to dominance is one of the most dramatic events of biome evolution in Earth history. Grasses possess two main photosynthetic pathways: the C3 pathway that is typical of most plants and a specialized C4 pathway that minimizes photorespiration and thus increases photosynthetic performance in high-temperature and/or low-CO2 environments. C4 grasses dominate tropical and subtropical grasslands and savannas, and C3 grasses dominate the world's cooler temperate grassland regions. This striking pattern has been attributed to C4 physiology, with the implication that the evolution of the pathway enabled C4 grasses to persist in warmer climates than their C3 relatives. We combined geospatial and molecular sequence data from two public archives to produce a 1,230-taxon phylogeny of the grasses with accompanying climate data for all species, extracted from more than 1.1 million herbarium specimens. Here we show that grasses are ancestrally a warm-adapted clade and that C4 evolution was not correlated with shifts between temperate and tropical biomes. Instead, 18 of 20 inferred C4 origins were correlated with marked reductions in mean annual precipitation. These changes are consistent with a shift out of tropical forest environments and into tropical woodland/savanna systems. We conclude that C4 evolution in grasses coincided largely with migration out of the understory and into open-canopy environments. Furthermore, we argue that the evolution of cold tolerance in certain C3 lineages is an overlooked innovation that has profoundly influenced the patterning of grassland communities across the globe.