Over at the Bad Astronomy site, there is a very clear explanation why we have leap years. It has to do with the number of days in a year not being exactly 365 days, but about 365.25. Adding extra days over the years has an effect of syncing the calendar with actual physical years. (Remember that 1 day = one rotation of the Earth and 1 year = one orbit of the Earth around the Sun.)
The algorithm to determine if a year (in A.D., like 2008; for B.E., subtract 543 first) is a leap year is this: If the year is divisible by 400, it’s a leap year. If it’s not divisible by 400 but divisible by 100, it’s not a leap year. If it’s not divisible by 100 but divisible by 4, it’s a leap year. Other years are not a leap year.
Besides the article, the site is an excellent source of information about science and astronomy. A few of my favorite articles are Bad Movies, Apollo Moon Hoax, Coriolis Effect vs. Water Drain Direction (and here too), and Just Another Face in the Crowd.