What does the implication $(Q\leftrightarrow Q')\rightarrow (P\leftrightarrow P')$ say: if Q and Q' have same truth value then P and P' have same truth value. Now, it should be obvious why this implication holds.
If you are still not convinced, lets try to take it slowly. How we should prove an implication? Well, we should conjecture antecedent and then derive consequent. So, lets assume that $Q\leftrightarrow Q'$ holds. Then, if we replace every occurrence of $Q$ with $Q'$ in $P$ we will get formula $P'$. But this formula has same truth value as $P'$ because $Q$ has same truth value as $Q'$. So, it is true that $P\leftrightarrow P'$. Thus, we proved the implication $(Q\leftrightarrow Q')\rightarrow (P\leftrightarrow P')$.
In other words, formulas $P$ and $P'$ are semantically equivalent even if they are potentially different formulas (takan as sequences of symbols). For example, formulas $\neg(p\land q)$ and $\neg p \lor \neg q$ are different but they have same truth tables (check this). So we can exchange them in other formulas without altering truth values of those formulas.
Formally, this statement is proved by induction on subformulas of $P$.