First thing to notice:
The first row are column headers, the first column are row headers.
The remaining squares are constructed from these headers.
From there I see two patterns:
The yellow cells are the XOR of the row header and the column header.
Possibly covered by a red or blue cell.
Where there is a blue cell in a square, there is a red cell in the next square on the right or below.
From these you can conclude:
The red cell placement only leaves A as a possible answer.
That option is also compatible with the rule for the yellow cells.
There might be an additional rule telling where the blue cells are. I haven't found it.
Update: I got it wrong! Here is the correct answer:
The yellow cells are the XOR of the row and column headers. That is still OK.
The red cell covers the first or next white square after the position in the previous square.
The blue cell covers the first or next yellow square after the position in the previous square.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/SKICc.png)
So the correct answer is E.