Many allergic reacties are caused by the degranulation of the mastcell. Probably because it's membrane is unstable. This degranulation starts a cascade of reactions which are called an allergic reaction.
Prolonged exposure to an allergen will help stabalise the membrane making the mastcell more stable and less likely to degranulate, making the system less vulnerable to that allergen.
This does not always work though. Another way is stabalising the membrane by other means, for example an antihistamine (when the mastcell degranulates, histamine is released).