Step 1: Frequency depends on the horizontal field.
A compass needle oscillates in the horizontal component of the field, $B_H = B\cos\theta$, where $\theta$ is the dip. The oscillation rate satisfies \[ n \propto \sqrt{B_H} = \sqrt{B\cos\theta}. \]
Step 2: Form the ratio of the two cases.
\[ \frac{n_1}{n_2} = \sqrt{\frac{B_1\cos\theta_1}{B_2\cos\theta_2}}. \]
Step 3: Put in the data.
With $n_1 = 20$, $n_2 = 30$, $\theta_1 = 45^\circ$, $\theta_2 = 30^\circ$, \[ \frac{20}{30} = \sqrt{\frac{B_1\cos45^\circ}{B_2\cos30^\circ}}. \]
Step 4: Square both sides.
\[ \frac{4}{9} = \frac{B_1}{B_2}\cdot\frac{\cos45^\circ}{\cos30^\circ} = \frac{B_1}{B_2}\cdot\frac{1/\sqrt2}{\sqrt3/2} = \frac{B_1}{B_2}\cdot\frac{2}{\sqrt6}. \]
Step 5: Solve for the ratio.
\[ \frac{B_1}{B_2} = \frac{4}{9}\cdot\frac{\sqrt6}{2} = \frac{2\sqrt6}{9}. \]
Step 6: Match it to a clean form and conclude.
Notice \[ \frac{2\sqrt2}{3\sqrt3} = \frac{2\sqrt2\cdot\sqrt3}{3\cdot 3} = \frac{2\sqrt6}{9}, \] so $B_1 : B_2 = 2\sqrt2 : 3\sqrt3$.
\[ \boxed{2\sqrt2 : 3\sqrt3} \]