The purpose of a buffer solution is to maintain a constant pH with the addition of a small amount of acid or base. In order to do this a buffer must be composed of a weak acid and the salt of its conjugate base or a weak base anad the salt of its conjugate acid. Remember that weak acids or bases have equilibrium reactions and can shift towards the right or left to adjust to changes in the system such as the addition of acid or base.
If we look at a generic weak acid, HA, we can see the following
HA + H2O <--> A- + H3O+
Addition of an acid will result in the reaction shifting to the left to minimize the disturbanace of more acid. Addition of a base will result in the reaction shifting to the right as the OH- from the base will react with the H3O+ and form more water molecules so the system responds by producing more H3O+.
One example of buffers in our lives is our blood which actually contains multiple buffers to maintain a pH of 7.4. Only small variations of the pH can be tolerated (7.35-7.45) by the body without seeing negative consequences.