Scheme over S and morphisms Quoting from Hartshorne 

Let $S$ be a fixed scheme. A scheme over $S$ is a scheme $X$, together with a morphism $X \to S$. If $X$ and $Y$ are schemes over $S$, a morphism of $X$ to $Y$ as schemes over $S$, (also called an $S$ morphism ) is a morphism $X \to Y$ which is compatible with the given morphisms to $S$. 

There are two things I don't understand.
a) What is meant by "morphism $X \to Y$ which is compatible with the given morphisms to $S$". I don't understand what condition needs to be satisfied for the required compatibility. Can anyone please tell me what actual conditions (in terms of maps) are required to be satisfied?
b)What is the intuition behind this definition ?
 A: Here's one motivation. Suppose you want to do "geometry." By this I mean you are working with varieties over an algebraically closed field, say $\overline{\mathbb{Q}}$. By working in the category of schemes over $S=Spec(\overline{\mathbb{Q}})$ you kill off all sorts of morphisms that aren't "coming from geometry." We'll get to what that means after an example.
If we are honestly doing geometry, then we would expect that since $S$ is just geometrically a single point that it's automorphism group would be trivial. But consider any $\sigma\in Gal(\overline{\mathbb{Q}}/\mathbb{Q})$. As long as $\sigma$ is not the identity map, we get a non-trivial automorphism after applying Spec which we'll call the same thing $\sigma: S\to S$. Thus $Aut(S)$ contains at least the enormous group $Gal(\overline{\mathbb{Q}}/\mathbb{Q})$ (it is in fact equal to this).
This is hardly what we would like to call morphisms coming from geometry. This is what happens when we just work in terms of (non-relative) schemes. We seem to pick up all sorts of morphisms coming from number theoretic or arithmetic sources. Now let's consider $S$ as a scheme over $S$ with the trivial strucutre map $id_S: S\to S$.
Now if we check whether or not any non-trivial $\sigma: S\to S$ is in the automorphism group of $S$ as an $S$-scheme we see it can't be because the appropriate diagram will not commute. In the category of $S$-schemes we see that we actually kill off all the non-geometric automorphisms and $Aut_S(S)$ is just the single identity map we thought we should get.
At first, it looks like considering this more complicated category will make things ... more complicated, but in practice we usual do exactly the situation above. If $X, Y$ are varieties over $k=\overline{k}$, then we work in the category of $k$-schemes. It will simplify things by killing off the non-geometric morphisms. 
A: For a ring with a morphism from $R$, you can identify the underlying set of the image of $R$ with $R$-elements. Furthermore, by considering only arrows that form commutative triangles from $R$, you impose a cross-ring convention for identifying elements with one another. Likewise, you can identify points of a scheme over $S$ with the points they map to on $S$, and this convention will hold globally if morphisms of schemes over $S$ are required to commute with the arrows to $S$ from the domain and codomain.
These are called the categories of rings under $R$, or $R$-algebras, and schemes over $S$, and are examples of a generic construction in category theory called an arrow category. It helps clarify how a morphism is supposed to know which arrows to commute with to treat the category's objects as the morphisms from $R$ or to $S$ themselves, not the rings or schemes.
