Factoring is decomposing a higher powered expression into a lower powered expressions that are multiplied together. Since (a-b)(a^2+ab+b^2) is lower powered than a^3-b^3, (a-b)(a^2+ab+b^2) is more simplified.
The Difference of Cubes formula shows up frequently in mathematics courses and should be memorized.
The formula for factoring the difference of cubes is (a^3 - b^3)= (a-b)(a^2+ab+b^2). It works because if (a-b)(a^2+ab+b^2) is multiplied it out, then it becomes a^3 - b^3. This was probably originally determined by trial and error a long time ago.
Since x is cubed and 8 is 2^3 it factors with the Difference of Cubes Formula. (x^3-2^3)=(x-2)(x^2+2x+2^2)=(x^2+2x+4)