The rule actually said, the non-qualified use period doesn't include any three years period after the two years of primary residence.
Non-qualfied use period = period you have to pay capital gain tax.
Example: primary residence (PR) for 10 years, moved out, rented for 3 years, and then moved back in and lived for 2 years.
ownership perod = 10 + 3 + 2 = 15. non-qualifed use period = 3, therefore 3/15 of the capital gain is taxable.
Example: PR for 10 years, rented for 3 years, PR for another 2 years, then rented for 3 years.
ownershihp period = 18 years, non qualified use period = 3. The final 3 years of rental is not counted as non-qualified use. So only 3/18 is taxable.
This is why I say, there is a three years grace period after two years of primary residence.
Note: the statement of "3/15 of the capital gain is taxable" is a simplification of the actual tax law. The actual law says how much percentage of the 500K exemption you can enjoy. But the logic is too twisted to explain clearly. You need to do the related worksheet to determine the exact amount.