This is the "templates and roots" system in action.
So you have 2 templates:
a) 2a••a• (masculine)
b) •a••aa2 (feminine)
You fill the missing letters with the template to get the full word.
For "b-y-D" (white):
For "z-r-q" (blue):
Interestingly, in addition to colors, some "defects" (e.g. deaf, blind) also use this pattern.