$$\lim_{x\to0}\frac{\tan x-x}{x^3}=\lim_{x\to0}\frac{\sec^2 x-1}{3x^2}=\lim_{x\to0}\frac{2\sec^2x\tan x}{6x}\\ =\frac{1}{3}\lim_{x\to0}\frac{\tan x}{x}=\frac{1}{3}\lim\limits_{x\to0}\frac{\sec^2x}{1}=\frac{1}{3}$$
My question is about the last line. Why do they set the two expressions $\frac{\tan x}{x}$ and $\frac{\sec^2x}{1}$ equal to each other and why is the one-third in both sets of expressions, instead of multiplying the two expressions? Also what happens to the $x$ under the $\sec^2x$?
It doesn't say $\dfrac{\tan x} x$ is equal to $\dfrac{\sec^2 x} 1;$ rather it says $\lim\limits_{x\to0} \dfrac{\tan x} x = \lim\limits_{x\to0} \dfrac{\sec^2 x} 1.$
Their limits as $x\to0$ are equal; the functions themselves are not.
The reason for the conclusion that they are equal is the same as the reason for the equalities in $$ \lim_{x\to0}\frac{\tan x-x}{x^3}=\lim_{x\to0}\frac{\sec^2 x-1}{3x^2} =\lim_{x\to0}\frac{2\sec^2x\tan x}{6x}. $$ That reason is L'Hopital's rule.
The next equality after that is not deduced from L'Hopital's rule, but from the equality $$ \lim_{x\to0} \sec^2 x = 1. $$