It looks like ordinary division of numbers, but \mathrm dx and \mathrm dy are not ordinary numbers. However, we manipulate them symbolically in a way that appears like they are real numbers, for the sake of intuition. But we can do this without loss of precision! A good demonstration of it is using the substitution rule for integrals:
\int f'(g(x))g'(x) \mathrm dx
Substituting u = g(x), we get, by the chain rule for derivatives,
\int f'(u) \frac{\mathrm du}{\mathrm dx} {\mathrm dx} = f(u) + C = \int f'(u) \mathrm du
The last equality is given by the definition of antiderivative. Though we didn't actually "cancel out" the differentials like fractions, it does turn out that we can safely write \frac{\mathrm du}{\mathrm dx} {\mathrm dx} = \mathrm du, by the chain of equalities. Note that the justification for this, however, has nothing to do with fractions.