Facet grids function by creating small multiples of a plot, where each plot represents a subset of the data. These subsets are formed based on one or more categorical variables. For example, an epidemiologist studying the incidence of influenza might create facet grids to show the data segmented by age groups and regions.