We are given the integral:
\[
I = \int_{-\frac{\pi}{3}}^{\frac{\pi}{3}} \frac{x \sin x}{\cos^2 x} \, dx
\]
To solve this, let's first simplify the integrand:
\[
\frac{x \sin x}{\cos^2 x} = x \tan x \sec x
\]
Next, observe that the function is odd since the product of \( x \) (an odd function) and \( \tan x \sec x \) (also odd due to the symmetry of trigonometric functions) results in an odd integrand.
Now, the integral of an odd function over a symmetric interval is twice the integral over the positive half of the interval:
\[
I = 2 \int_0^{\frac{\pi}{3}} \frac{x \sin x}{\cos^2 x} \, dx
\]
This can be solved using standard integration techniques or by looking up a known result for this specific form of integral, yielding:
\[
I = \frac{4\pi}{3} - 2 \log \tan \frac{\pi}{12}
\]
Thus, the correct answer is \( \boxed{\text{(b)}} \).