That's the "2 of last 5" capital gains tax exclusion rule.
Basically, if you lived in the house for at least 2 of the last 5 years you owned it as your primary residence, counting back from the date of the sale, then the first $250,000 of gain is exempt from federal taxation. If filing a joint return and both tax filers meet the "2 of last 5" rule, then the first $500,000 of gain is tax deductible.
When you do this, then you have to wait "at least" 2 years to sell another qualifying house to get the exclusion again.