Say $S$ is the set of $j$ with $a_j=b_j$ and $T$ is the set of $j$ with $a_j=-b_j$. Let $$A(x)=\sum_{j\in S}a_jx_j,\quad B(x)=\sum_{j\in T}a_jx_j.$$
Then $$F(x)=(A+B)^2+(A-B)^2=2A(x)^2+2B(x)^2.$$
Since none of the variables appear in both $A(x)$ and $B(x)$ we get the maximum by maximizing $A^2$ and $B^2$ separately. And so the maximum of $F$ is $$2|S|^2+2|T|^2,$$where $|S|$ denotes the number of elements of $S$ and I'll just let you guess what $|T|$ is.
Ah, you wanted to know when $F$ is maximized. Looks like the maximum is achieved at four points: $x=a,b,-a,-b$.
And we get the minimum by minimizing $A^2$ and $B^2$ separately. The minimum of $A^2$ is $0$ or $1$ depending on whether $|S|$ is even or odd. Similarly for $B^2$, so the minimum of $F$ is $0$, $2$, or $4$, depending on the parity of $|S|$ and $|T|$.