The "fundamental theorem of calculus" (part of it) says the if [itex]F(x)= \int f(x) dx[/itex], then dF/dx= f(x). That says that [itex]d/dx \int_a^x f(t)dt= f(x)[/itex]. (The other part says that if f(x)= dF/dx, then [itex]F(x)= \int f(x)dx+ C[/itex] for some constant C.)
"Leibniz's formula" is more general:
[tex]\frac{d}{dx}\int_{\alpha(x)}^{\beta(x)} f(x,t)dt=f(x, \beta(x))\frac{d\beta(x)}{dx}- f(x, \alpha(x))\frac{d\alpha(x)}{dx}+ \int_{\alpha(x)}^{\beta(x)} \frac{\partial f(x, t)}{\partial x}dt[/tex].
The "fundamental theorem" is clearly a special case of "Leibniz's formula" with [itex]\alpha(x)= 0[/itex], so that [itex]d\alpha/dx= 0[/itex], [itex]\beta(x)= x[/itex] so that [itex]d\beta/dx= 1[/itex] and f(t) not a function of x so that [itex]\partial f/\partial x= 0[/itex]:
[tex]\frac{d}{dx}\int_0^x f(t)dt= (1)f(x)- (0)f(0)+ \int_0^x 0 dt= f(x)[/tex].
To do the initial example, [itex]d/dx\int_0^x cos(t^2)dt[/itex], you just need the "fundamental theorem", [itex]d/dx\int_0^x cos(t^2)dt= cos(x^2)[/itex].
To do the example elfmotat gives, [itex]d/dx \int_0^{x^2} cos(t^2)dt[/itex] take [itex]\beta(x)= x^2[/itex], so that [itex]d\beta/dx= 2x[/itex], and [itex]\alpha(x)= 0[/itex]. [itex]f(x, t)= cos(t^2)[/itex] which does NOT depend on x so that [itex]\partial f/\partial x= 0[/itex]. Leibniz' forumula becomes
[tex]2x cos((x^2)^2)- 0 cos(0^2)+ \int_0^{x^2} 0 dt= 2x cos(x^4)[/tex].