Elucidating on the basis of the usual particle-wave duality: the other answer mentioned resonance condition on the light frequency, but I personally like to think about it in the particle sense.
Light in this sense is nothing but a bunch of particles. If your light source has only one wavelength (eg. monochromatic), then all light particles have the same energy. Now, when something absorbs the light, this energy must be taken up by the absorbing matter.
A peculiarity of quantum mechanics is that in many cases, the matter can not have any energy, it can only have certain discrete energy values. Before the light hits the matter, it has a certain amount of energy (it is in the so-called ground state), and after it absorbs the light particle, it will have more energy.
Here's the catch: since the matter can only have pre-defined values of energy, it can only absorb light that has a wavelength that corresponds to an energy difference between the ground state and the level that it will get excited to.
Note that this is exactly the same description as the one based on the resonance condition with the frequency of the light. I prefer this one because for me this picture is easier to generalize for example to the cases of multiphoton absorption.