Consider the definition of group scheme in Stack Project [022R]. In the paragraph following definition 39.4.1, it is said that
We have morphisms of schemes over $S$: (identity) $e:S\rightarrow G$ and (inverse) $i:G\rightarrow G$ such that for every $T$ the quadruple $(G(T)=Hom(T,G),m,e,i)$ satisfies the axioms of a group listed above.
As for my intuition, the identity is the identity of $G(S)$, and the inverse is the inverse of $id : G\rightarrow G$ in $G(G)$. But I don't know how to check that $(G(T),m,e,i)$ is a group.