While it certain isn't true that $M_{t_{i+1}}^2 - M_{t_i}^2 = (M_{t_{i+1}} - M_{t_i})^2$, their expectations are the same. To see this, first assume that $M$ is a martingale, and use the tower property for conditional expectations:
$$\begin{align*}
\mathbb{E}[(M_{t_{i+1}} - M_{t_i})^2] &= \mathbb{E}(M_{t_{i+1}}^2) - \mathbb{E}[\mathbb{E}(2M_{t_{i+1} M_{t_i}} \, | \, \mathcal{F}_{t_i})] + \mathbb{E}(M_{t_{i}}^2) & \text{(tower property)}\\
&= \mathbb{E}(M_{t_{i+1}}^2) - 2\mathbb{E}[M_{t_i}\mathbb{E}(M_{t_{i+1} } \, | \, \mathcal{F}_{t_i})] + \mathbb{E}(M_{t_{i}}^2) & (M_{t_i} \text{ is }\mathcal{F}_{t_i}\text{-measurable}) \\
&= \mathbb{E}(M_{t_{i+1}}^2) - 2\mathbb{E}[M_{t_i}^2] + \mathbb{E}(M_{t_{i}}^2) & (\mathbb{E}(M_{t_{i+1} } \, | \, \mathcal{F}_{t_i}) = M_{t_i}) \\
&= \mathbb{E}(M_{t_{i+1}}^2 - M_{t_i}^2)
\end{align*}$$
If $M$ is a local martingale, let $(\tau^n)$ be a localising sequence of stopping times (i.e. the processes $M_{t\land \tau^n}$ are martingales and $\tau^n \to \infty$ almost surely); then:
$$\begin{align*}
\mathbb{E}[(M_{t_{i+1}} - M_{t_i})^2] &= \lim_{n \to \infty} \mathbb{E}[(M_{t_{i+1} \land \tau^n} - M_{t_i\land \tau^n})^2] \\
&= \lim_{n \to \infty }\mathbb{E}(M_{t_{i+1} \land \tau^n}^2) - \mathbb{E}(M_{t_{i} \land \tau^n}^2) \\
&= \mathbb{E}(M_{t_{i+1}}^2 - M_{t_i}^2)
\end{align*}$$