So we have two opposing forces all things considered. We have the force of gravity pulling the box down and the force of friction trying to resist the force of gravity.
The force of gravity is mg
but because you are trying to find acceleration in the x component, we use cos (theta) to get the horizontal component
so the force of gravity on the box is mg cos theta
Now on friction
The force of friction is (mu) * normal force
Normal force is mg sin theta because you are trying to get the vertical component of gravity for friction
so mg (mu) sin theta is the downward force
combining what we have
Net Force = mg cos theta - mg (mu) sin theta
Net force = ma, and by dividing out mass,
we get
a = g cos theta - g (mu) sin theta, which simplifies down to a = g (cos theta - mu sin theta)