The mechanism of resonance  

Resonance is a very general physical mechanism, that takes place when two phenomena have particular frequencies (or periods) that amplify the phenomena.
In particular, resonance has an important dynamical role. It can take place in any n-body problem, and is easily comprehensible in the case of the solar system .

What is resonance ?
Let's consider the approximated orbit of a light body (for example an asteroid) around the Sun, calculated with a 2-body approximation. This asteroid is sufficiently close to Jupiter (which has a mass of 1/1000 the mass of the Sun) to be influenced by its attraction.

A representation of the orbit of an asteroid in resonance 2:1 (on the left) and on resonance 3:1 (on the right).
Click here to know more about mean-mode resonance.

As it is well known, the Newton attraction force between two bodies is inversely proportional to their distance. So, when Jupiter and the asteroid come to their closest approach, the asteroid receives its maximum pull from the planet, which contributes to move it from its original orbit.
If the periods of Jupiter and the asteroid are not proportional, the two bodies come close to each other randomly, and the overall effect of the attraction between them is null. On the other hand, the interaction between Jupiter and the asteroid is not negligible when the orbits of the two bodies have resonant periods, meaning that the period of the asteroid is a fraction of the period of Jupiter. For example, knowing that Jupiter revolves around the Sun with a period of 12 years, let's consider an asteroid with a period of about 4 years: it will complete 3 revolutions for every one of Jupiter, and in this case, the two bodies will come near each other, three times every 12 years (resonance 3:1). In this and in other similar resonant cases the perturbation is maximum, and the asteroid's orbit is unstable.
An interesting consequence is the depletion of objects in those zones of the main belt that correspond to a resonant orbit (this is a physical explanation for the presence of the Kirkwood gaps in the main belt of asteroids).

Secular and mean mode of resonance

The kind of resonance with the planet Jupiter described above, is called mean mode resonance (click here to know more about mean mode resonance). The main consequence of this mechanism is the fact that the characteristics of the orbits change in time (and it's for this reason that these values are normally given as mean values). This kind of resonance, has a time-scale that can range from "short" periods of thousands years, to much longer periods.

There is another kind of resonance, with a much longer time-scale, called secular resonance. This kind of resonance is mainly responsible of the precession of the perihelion.