In modern terms, a “blue moon” refers to the second full moon of the month, which typically has only one full moon. This happens once every few years.
However, historically, a “blue moon” referred to a rarer phenomenon: the fourth full moon in a season, which would typically have only three. That is why people use the idiom “once in a blue moon” to mean “very rarely.”