Let's see what happens if we switch $m_1$ and $m_2$. First call $\theta_1$ an angle such that $\tan\theta_1 = \frac{m_2-m_1}{1+m_1m_2}$ and $\theta_2$ such that $\tan\theta_2 = \frac{m_1-m_2}{1+m_2m_1}$. Immediately you can see that $\tan\theta_1 = -\tan\theta_2$ and by tangens being odd function, we get $\tan\theta_1 = \tan(-\theta_2)$. If we restrict our $\theta$'s to $\langle-\pi/2,\pi/2\rangle$ (which we usually do in this case since we want the acute angle between lines) we get that $\theta_2 = -\theta_1$ so it is "the same" angle but measured in opposite directions (clockwise or counterclockwise).

In conclusion, $\theta_1$ is the angle between lines $l_1$ and $l_2$ measured from line $l_1$ to $l_2$ and $\theta_2$ is the angle between $l_1$ and $l_2$ measured from $l_2$ to $l_1$. They are of the same absolute value, but opposite orientations.

If you don't want to be bothered with orientation, you can change formula to $\tan\theta =\left|\frac{m_2-m_1}{1+m_1m_2}\right|$ and you will always get a positive angle and switching $m_1$ and $m_2$ won't change it since $|m_2-m_1|=|m_1-m_2|$.