Algorithms for finding structure in data can help to explain how humans learn structured representations. Conventional algorithms learn structures of a single form that is specified in advance: for instance, algorithms for hierarchical clustering create tree structures, and algorithms for dimensionality-reduction create low-dimensional spaces. Unlike these algorithms, humans learn structures of many different forms, and discover for themselves which kind of structure is best for a data set. Linnaeus recognized the hierarchical structure of biological species, Mendeleev recognized the periodic structure of the chemical elements, and children may make analogous discoveries as they learn the organizing principles of their world. I will present a probabilistic model that explains discoveries like these as statistical inferences over a hypothesis space of graph grammars. The model successfully discovers structural forms for a variety of physical, biological and social domains, and helps to explain data from two behavioral experiments.