How would one calculate the synodic period between 3 planets? I don't know if this is the correct term, but how would one calculate the time it takes for 3 planets to lie on the same line?
Normally three planets would not line up along a simple line like that.  Planets have orbits with different inclinations, so at best they'd be in the same plane.

Working that out requires a detailed calculation of their motions.  The simplest approximation is to actually assume everything has the same inclination and treat the orbits as circles (which they're not precisely).

For this simple model, a planet's angular position $\theta$ at any time $t$ is given by :

$$\theta(t) = \theta_0+t\frac {2\pi} T$$

Where $T$ is the orbital period and $\theta_0$ is the initial angle.

What you want is the value of $t$ satisfying :

$$\theta_1(t) = \theta_2(t) + 2m\pi = \theta_3(t)+2n\pi$$

Where the $n$ and $m$ values are integers.

Now doing this for two planets is easy, we get :

$$t_{12}=\left(\frac {\theta_{10}-\theta_{20}}{2\pi} - m\right)\frac{T_1T_2}{T_2-T_1}$$

$$t_{13}=\left(\frac {\theta_{10}-\theta_{30}}{2\pi} - n\right)\frac{T_1T_3}{T_3-T_1}$$

Remember we have to work out those $m$ and $n$ values to get a result !

But the problem is that we need to get integer values and all the other values are real numbers.  This means that there may be no (exact) solution that produces integer values and hence no one time when they all line up.

Now in the real world their are some other issues :


The orbital inclinations mean we need to work in three dimensions
The orbits will be ellipses, not circles, and if we want even more accuracy they're not even convenient shapes like that (look up the three body problem to get an idea why).
The speed of light is finite.  So what "lined up" means is not as simple as it seems.  There might be only one observer who would say they were lined up and every other observer would consider them not lined up.
Planets have non-zero sizes, so we can allow them to be lined up within a range of values, not a simple set of numbers, but a whole set of ranges of values.
Again with time in general relativity, whose time are using as a reference.  That's a really complicated one in general relativity (more than it might seem), but fortunately to a good approximation we can ignore relativity a lot of the time or use small corrective factors.
All our measurements for the parameters of the orbit will have a finite accuracy and some uncertainty range.  So, particularly over very long periods of time, our calculations can become inaccurate.