We can approach this problem in a general sense as
d/dx [∫g(x)h(x) f(t) dt].
Pay close attention to how the variables t and x are used. The outer derivative is with respect to x, and the limits of integration are both functions of x. The integrand is a function of t and the integral is carried out with respect to t.
The integral is the innermost operation, so let's do that first. We evaluate a definite integral by (1) finding the antiderivative of the integrand (2) plugging in the two limits of integration (3) finding their difference.
Let F(t) be an antiderivative of f(t). That simply means F'(t)=f(t). Then ∫ab f(t) dt = F[b]-F[a].
For the particular limits of integration here, the integral equals F[h(x)] - F[g(x)]. Notice that we integrated out the t-variable and what we're left with is only a function of x. That means taking the derivative will be easy!
Differentiating requires us to apply the chain rule:
d/dx [ F[h(x)] - F[g(x)] ] = F'[h(x)] h'(x) - F'[g(x)] g'(x).
But remember that F'(x) = f(x), so really
= f(h(x))*h'(x) - f(g(x))*g'(x).
For your problem in particular, f(t)=cos(t2), h(x)=4x, and g(x)=cos(x).