$\textbf{Only-IF}$:Revealing the Decisive Effect of Instruction Diversity on Generalization