Rewrite $ 9x^2-y^2 $ as:
$$ \color{blue}{ 9x^2-y^2 = (3x)^2 - (y)^2 } $$Now we can apply the difference of squares formula.
$$ I^2 - II^2 = (I - II)(I + II) $$After putting $ I = 3x $ and $ II = y $ , we have:
$$ 9x^2-y^2 = (3x)^2 - (y)^2 = ( 3x-y ) ( 3x+y ) $$