Option (B) is correct.
Use the addition formula, valid while the product of the two arguments is less than 1:
tan−1a+tan−1b=tan−11−aba+b(ab<1).
With a=3 and b=x the equation tan−13+tan−1x=tan−18 becomes
1−3x3+x=8.
Hence
3+x=8(1−3x)=8−24x⟹25x=5⟹x=51.
The condition has to be checked, and it holds: ab=3⋅51=53<1. Numerically tan−13+tan−151=1.2490+0.1974=1.4464=tan−18. ✓
Option (A), x=5, would give ab=15>1, where the formula acquires an extra π and the equation fails.