Answer
The distribution of atomic and molecular energy levels differs between materials.
Work Step by Step
Light is emitted by atoms when electrons fall from a higher energy level to a lower one. The energy is given up as a photon of light. In a flame, it is heat energy that initially excites the electrons to their so-called "excited state", after which they fall and emit light.
Because the distribution of atomic and molecular energy levels differs between materials, the spectrum of emitted frequencies also differs.
Emission spectra are discussed on pages 566-567.