To answer to this question, try to make a scheme of the situation.
You have two masses $m_1$ and $m_2$. By definition, the subscript on the forces will have as first number the index of the mass that causes the force and as second one the index of the object on which this force is applied. Since you are evaluating $F_{12}$ and we know from our physical intuition that gravitational force is attractive, you can draw it as directed from the center of mass 2 toward the center of mass 1.
If you then analyze the definition of the vector $\vec{r}_{12}$, you can see that it is defined as:
$$\vec{r}_{12} = \vec{r}_2 - \vec{r}_1$$
and by applying the rule for adding vectors, you can see that it should be directed from mass 1 to mass 2. Then, normalizing it you can have the relative unitary vector $\hat{r}_{12}$.
From the diagram, you can then see that $\vec{F}_{12}$ and $\vec{r}_{12}$ are on the same line, but pointing in different directions: the minus sign is due to this difference.
The same applies to your book, where I suppose it is used a different convention to label subscripts of forces.
These equations could be written without the minus sign just by choosing a different unitary vector, with the right direction. On the other hand, the minus sign is relevant because it is conventionally associated with attractive forces. Of course, the gravitational force is always attractive, so this minus sign is always present, but in different kind of forces such as Coulomb force, a negative module means an attractive force while a positive module means a repulsive one, and the sign of the module comes from the sign of the charges.