Explanation
The core of this formula is the MOD function. MOD takes a number and divisor, and returns the remainder after division, which makes it useful for formulas that need to do something every nth time.
In this case, the number is created with the COLUMN function, which return the column number of cell B8, the number 2, minus 1, which is supplied as an "offset". We use an offset, because we want to make sure we start counting at 1, regardless of the actual column number.
The divisor is hardcoded as 3, since we want to do something every 3rd month. By testing for a zero remainder, this expression will return TRUE at the 3rd, 6th, 9th, and 12th months:
MOD(COLUMN(B8)-1,3)=0
Finally, IF simply evaluates the MOD expression and returns value in B5 (coded as an absolute reference to prevent changes as the formula is copied) when TRUE and zero when FALSE.
Working with a date
If you need to repeat a value every n months, and you are working directly with dates, see this example.