The optical signals of single molecules provide information about structure and dynamics of their nanoscale environment, free from space and time averaging. These new data are particularly useful whenever complex structures or dynamics are present, as in polymers or in porous oxides, but also in many other classes of materials, where heterogeneity is less obvious. We review the main uses of single molecules in studies of condensed matter at nanometer scales, especially in the fields of soft matter and materials science. We discuss several examples, including the orientation distribution of molecules in crystals, rotational diffusion in glass-forming molecular liquids, polymer studies with probes and labeled chains, porous and heterogeneous oxide materials, blinking of single molecules and nanocrystals, and the potential of surface-enhanced Raman scattering for local chemical analysis. All these examples show that static and dynamic heterogeneities and the spread of molecular parameters are much larger than previously imagined.