We investigate magnetic properties of Mott-insulating phases of ultracold Bose and Fermi spinor gases in optical lattices. We consider in particular the F = 2 Bose gas, and the F = 3/2 and 5/2 Fermi gases. We derive effective spin Hamiltonians for one and two atoms per site and discuss the possibilities of manipulating the magnetic properties of the system using optical Feshbach resonances. We discuss low temperature quantum phases of a Rb-87 gas in the F = 2 hyperfine state, as well as possible realizations of high spin Fermi gases with either Li-6 or Cs-132 atoms in the F = 3/2 state, and with Yb-173 atoms in the F = 5/2 state.