If we displace masses $m_1$ and $m_2$ (connected by spring of spring constant $k_{eq}$) towards each other and then release them, they will undergo simple harmonic motion (with their center of mass at rest)

So, let’s write the newton’s law $F = ma = m \cfrac{d^2 x}{dt^2}$ for mass $m_1$, when it is a distance $\delta_1$ from its mean position towards left

Well to determine the restoring spring force $F$, we need to know the total extension of the spring when $m_1$ is at $\delta_1$ to the left of its mean position.

Well recall that $x_{cm} = \cfrac{m_1 x_1 + m_2 x_2}{m_1 + m_2}$

Now if you take origin at center of mass then $m_1 x_1 + m_2 x_2 = 0$ or $m_1 \delta_1 + m_2 \delta_2 = 0$ or $\delta_2 = – \cfrac{m_1}{m_2} \delta_1$ with minus sign indicating that if $\delta_1$ was towards left $\delta_2$ will be towards right

so net extension of the spring $=\delta_1 + \delta_2 = \cfrac{m_1 + m_2}{m_2} \delta_1$

or, $-k_{eq} \cfrac{m_1 + m_2}{m_2} \delta_1$ $=m_1 \cfrac{d^2 \delta_1}{dt^2}$

or $\cfrac{d^2 \delta_1}{dt^2} = – \cfrac{k_{eq}}{\cfrac{m_1 m_2}{m_1+m_2}} \delta_1$

i.e. $\omega^2 = \cfrac{k_{eq}}{\cfrac{m_1 m_2}{m_1+m_2}}$