I will assume that you understand the 5! = 120 part. If all the cars were in diffrent colors then this should have been the outcome (i.e. BGRYO)

but since you have BBBRG (repeting B color three times) and since B2B1 is the same as B1B2, you need to narrow your 5! by removeing the repeating outcomes.

The best way is to divide by the meaningless outcomes (like B1B2 = B2B1)

let's see a simple example:
two colors for three cars:

B = blue

G1,G2 = green

3! = 6

BG1G2

G1BG2

G1G2B

BG2G1

G2BG1

G2G1B

n = 6

-----------------------------------------------------------------------------

but once we decide that G1=G2

the outcome is 3!/2! = 3 (total / repeated)

BGG

GGB

GBG

n = 3

lets return to our problem:
5!/3! (total / repeated)

n = 120/6 = 20