The reason that a buffer tends to keep the pH of a solution constant when extra acid or base is added is that the buffer contains a mixture of an acid and it's conjugate base (both of which are fairly weak).
Acetic acid (HAc) has the ability to react with any added strong base according to the reaction:
HAc + OH- ---> Ac- +H2O
Since the additional OH- ion from the base is neutralized by the acid, it does not substantially change the pH of the solution.
On the other hand, the acetate ion (Ac-) has the ability to accept a proton from a strong acid according to the equation:
Ac- + H+ --> HAc
Since the additional H+ ion from the acid is neutralized by the Ac- ion, it does not substantially change the pH of the solution.