How do you factor the difference of two cubes x^3-64?

${a}^{3} - {b}^{3} = \left(a - b\right) \left({a}^{2} + a b + {b}^{2}\right)$
So, in your case, since $a = x$ and $b = 4$,
${x}^{3} - 64 = \left(x - 4\right) \left({x}^{2} + 4 x + 16\right)$