If we have an connected reductive group (reductive probably doesn't matter, affine group scheme is what matters) $G_{\mathbb{Q}}$ over $\mathbb{Q}$, we may construct a flat affine $\mathbb{Z}$- group, such that its generic fiber is $G_{\mathbb{Q}}$ as follows:
Embed $G_{\mathbb{Q}} \hookrightarrow GL_{n,\mathbb{Q}}$. The latter being the generic fiber of the obvious $\mathbb{Z}$-group $GL_{n,\mathbb{Z}}$, we have the dominant map $GL_{n,\mathbb{Q}} \to GL_{n,\mathbb{Z}}$. The scheme-theoretic image of the composition $G_{\mathbb{Q}} \hookrightarrow GL_{n,\mathbb{Q}} \to GL_{n,\mathbb{Z}}$ defines a flat affine $\mathbb{Z}$-group.
What I want to show is that conversely any flat affine $\mathbb{Z}$-group arises in this way. i.e. start with $G_{\mathbb{Z}}$, take it's generic fiber, embed into $GL_n$ over $\mathbb{Q}$, map into the corresponding $\mathbb{Z}$-group, and the Zariski closure of the composition of this defines a group $G'_{\mathbb{Z}}$. This should be the same group we started with, but I don't see how to proceed, and I don't see where flatness fators into this.