There are two basic types of vesting (ask your benefits administrator which one applies to you):
Cliff vesting. This typically means that if you leave the job in five years or less, you lose all pension benefits. But if you leave after five years, you get 100% of your promised benefits.
Graded vesting. With this kind of vesting, at a minimum you're entitled to 20% of your benefit if you leave after three years. In each subsequent year, another 20% of your benefit vests. So if you stay for four years, you are vested in 40% of your benefit and so on; by the end of year seven, you are 100% vested in the plan, so you can leave the job knowing that you will get 100% of the pension benefits earned.