Group delay is a useful measure of time distortion, and is calculated by differentiating, with respect to frequency, the phase response of the device under test (DUT): the group delay is a measure of the slope of the phase response at any given frequency. Variations in group delay cause signal distortion, just as deviations from linear phase cause distortion.
In linear time-invariant (LTI) system theory, control theory, and in digital or analog signal processing, the relationship between the input signal, $x(t)$, to output signal, $y(t)$, of an LTI system is governed by a convolution operation:
$$y(t) = (h*x)(t) \ \triangleq \ \int_{-\infty}^{\infty} x(u) h(t-u) \, \mathrm{d}u $$
Or, in the frequency domain,
$$ Y(s) = H(s) X(s) \, $$
where
$$ X(s) = \mathscr{L} \Big\{ x(t) \Big\} \ \triangleq \ \int_{-\infty}^{\infty} x(t) e^{-st}\, \mathrm{d}t $$
$$ Y(s) = \mathscr{L} \Big\{ y(t) \Big\} \ \triangleq \ \int_{-\infty}^{\infty} y(t) e^{-st}\, \mathrm{d}t $$
and
$$ H(s) = \mathscr{L} \Big\{ h(t) \Big\} \ \triangleq \ \int_{-\infty}^{\infty} h(t) e^{-st}\, \mathrm{d}t $$
Here $h(t)$ is the time-domain impulse response of the LTI system and $X(s)$, $Y(s)$, $H(s)$, are the Laplace transforms of the input $x(t)$, output $y(t)$, and impulse response $h(t)$, respectively. $H(s)$ is called the transfer function of the LTI system and, like the impulse response $h(t)$, fully defines the input-output characteristics of the LTI system.
Suppose that such a system is driven by a quasi-sinusoidal signal, that is a sinusoid having an amplitude envelope $a(t)>0$ that is slowly changing relative to the frequency $\omega_0$ of the sinusoid. Mathematically, this means that the quasi-sinusoidal driving signal has the form
$$x(t) = a(t) \cos(\omega_0 t + \theta)$$
and the slowly changing amplitude envelope $a(t)$ means that
$$ \left| \frac{\mathrm{d}}{\mathrm{d}t} \log \big( a(t) \big) \right| \ll \omega_0 \ .$$
Then the output of such an LTI system is very well approximated as
$$ y(t) = \big| H(i \omega_0) \big| \ a(t - \tau_\text{g}(\omega_0)) \cos \big( \omega_0 (t - \tau_\phi(\omega_0)) + \theta \big) \; .$$
Here $\tau_\text{g}(\omega_0)$ and $\tau_\phi(\omega_0)$, the group delay and phase delay respectively, are given by the expressions below (and potentially are functions of the angular frequency $ \omega_0$). The sinusoid, as indicated by the zero crossings, is delayed in time by phase delay, $\tau_\phi(\omega_0)$. The envelope of the sinusoid is delayed in time by the group delay, $\tau_\text{g}(\omega_0)$.
In a linear phase system (with non-inverting gain), both $\tau_\text{g}$ and $\tau_\phi$ are constant (i.e. independent of frequency $\omega$) and equal, and their common value equals the overall delay of the system; and the unwrapped phase shift of the system (namely $-\omega \tau_\phi$) is negative, with magnitude increasing linearly with frequency $\omega$.
More generally, it can be shown that for an LTI system with transfer function $H(s)$ driven by a complex sinusoid of unit amplitude,
$$ x(t) = e^{i \omega t} $$
the output is
$$ \begin{align}
y(t) & = H(i \omega) \ e^{i \omega t} \ \\
& = \left( \big| H(i \omega) \big| e^{i \phi(\omega)} \right) \ e^{i \omega t} \ \\
& = \big| H(i \omega) \big| \ e^{i \left(\omega t + \phi(\omega) \right)} \ \\
\end{align} \ $$
where the phase shift $\phi$ is
$$ \phi(\omega) \ \triangleq \arg \Big\{ H(i \omega) \Big\} \;$$
Additionally, it can be shown that the group delay, $\tau_\text{g}$, and phase delay, $\tau_\phi$, are frequency-dependent, and they can be computed from the properly unwrapped phase shift $\phi$ by
$$\tau_\text{g}(\omega) = - \frac{\mathrm{d} \phi(\omega)}{\mathrm{d} \omega} = -\phi'(\omega) $$
$$ \tau_\phi(\omega) = - \frac{\phi(\omega)}{\omega} $$
Proof (sorta)
The Fourier Transform of
$$\begin{align}
x(t) &= a(t) \cos(\omega_0 t + \theta) \\
&= a(t) \tfrac12 (e^{i(\omega_0 t + \theta)} + e^{-i(\omega_0 t + \theta)} ) \\
&= \tfrac12 e^{-i\theta} a(t) e^{-i\omega_0 t} + \tfrac12 e^{i\theta} a(t) e^{i\omega_0 t} \\
\end{align}$$
is
$$ X(i\omega) = \tfrac12 e^{-i\theta} A\big(i(\omega+\omega_0)\big) + \tfrac12 e^{i\theta} A\big(i(\omega-\omega_0)\big) $$
where
$$ A(s) = \mathscr{L} \Big\{ a(t) \Big\} \ \triangleq \ \int_{-\infty}^{\infty} a(t) e^{-st}\, \mathrm{d}t $$
The Fourier Transform of the output $y(t)$ is
$$\begin{align}
Y(i\omega) &= H(i\omega) \cdot X(i\omega) \\
\\
&= H(i\omega) \cdot \Big( \tfrac12 e^{-i\theta} A\big(i(\omega+\omega_0)\big) + \tfrac12 e^{i\theta} A\big(i(\omega-\omega_0)\big) \Big) \\
\\
&= \tfrac12 H(i\omega) e^{-i\theta} A\big(i(\omega+\omega_0)\big) + \tfrac12 H(i\omega) e^{i\theta} A\big(i(\omega-\omega_0)\big)
\end{align} $$
Because $a(t)$ is slowly varying, that means that $A(i\omega)$ is bandlimited to much less than $\omega_0$.
$$ A(i\omega) \approx 0 \quad \text{unless} \ |\omega| \ll \omega_0 $$
That means the first term, $A\big(i(\omega+\omega_0)\big)$, is virtually zero except for $\omega \approx -\omega_0$ and the second term, $A\big(i(\omega-\omega_0)\big)$, is virtually zero except $\omega \approx +\omega_0$
The transfer function can be expressed in magnitude and phase form:
$$ H(i\omega) \triangleq |H(i\omega)| e^{i \phi(\omega)} $$
We know, for real $h(t)$ that $|H(-i\omega)| = |H(i\omega)|$ and $\phi(-\omega)=-\phi(\omega)$, and the derivative of phase $\phi'(-\omega)=\phi'(\omega)$.
Here we are approximating the phase function with the constant and first-order term of its Taylor series:
$$ \phi(\omega) \approx \phi(\omega_0) + \phi'(\omega_0)(\omega-\omega_0) \qquad \text{when} \ \omega \approx \omega_0 $$
$$ \phi(\omega) \approx \phi(-\omega_0) + \phi'(-\omega_0)(\omega+\omega_0) \qquad \text{when} \ \omega \approx -\omega_0 $$
Then in that narrow bandwidth the transfer function is approximated as
$$ H(i\omega) \big|_{\omega \approx \omega_0} \approx |H(i\omega_0)| e^{i (\phi(\omega_0) + \phi'(\omega_0)(\omega-\omega_0) )} $$
and similarly
$$\begin{align}
H(i\omega) \big|_{\omega \approx -\omega_0} &\approx |H(-i\omega_0)| e^{i (\phi(-\omega_0) + \phi'(-\omega_0)(\omega+\omega_0) )} \\
&=|H(i\omega_0)| e^{i (-\phi(\omega_0) + \phi'(\omega_0)(\omega+\omega_0) )} \\
\end{align}$$
Then
$$\begin{align}
Y(i\omega) &= \tfrac12 H(i\omega) e^{-i\theta} A\big(i(\omega+\omega_0)\big) + \tfrac12 H(i\omega) e^{i\theta} A\big(i(\omega-\omega_0)\big) \\
\\
&\approx \tfrac12 |H(i\omega_0)| e^{i (-\phi(\omega_0) + \phi'(\omega_0)(\omega+\omega_0) )} e^{-i\theta} A\big(i(\omega+\omega_0)\big) \\
& \qquad + \tfrac12 |H(i\omega_0)| e^{i (\phi(\omega_0) + \phi'(\omega_0)(\omega-\omega_0) )} e^{i\theta} A\big(i(\omega-\omega_0)\big) \\
\\
&= \tfrac12 |H(i\omega_0)| e^{\phi'(\omega_0)\omega} \Big( e^{i (-\phi(\omega_0) + \phi'(\omega_0)\omega_0 )} e^{-i\theta} A\big(i(\omega+\omega_0)\big) \\
& \qquad \qquad \qquad \qquad \qquad + \ e^{i (\phi(\omega_0) - \phi'(\omega_0)\omega_0 )} e^{i\theta} A\big(i(\omega-\omega_0)\big) \Big) \\
\\
&= e^{\phi'(\omega_0)\omega} \ \tilde{Y}(i\omega) \\
\end{align}$$
where
$$ \tilde{Y}(i\omega) = \tfrac12 |H(i\omega_0)| \Big(e^{i (-\phi(\omega_0) + \phi'(\omega_0)\omega_0 )} e^{-i\theta} A\big(i(\omega+\omega_0)\big) \\ \qquad \qquad \qquad \qquad \qquad + \ e^{i (\phi(\omega_0) - \phi'(\omega_0)\omega_0 )} e^{i\theta} A\big(i(\omega-\omega_0)\big) \Big)$$
The inverse Fourier Transform of $\tilde{Y}(i\omega)$ is
$$\begin{align}
\tilde{y}(t) &= \tfrac12 |H(i\omega_0)| \Big(e^{i (-\phi(\omega_0) + \phi'(\omega_0)\omega_0 )} e^{-i\theta} e^{-i\omega_0 t} a(t) + e^{i (\phi(\omega_0) - \phi'(\omega_0)\omega_0 )} e^{i\theta} e^{i\omega_0 t} a(t) \Big) \\
\\
&= |H(i\omega_0)| \ a(t) \ \tfrac12 \Big(e^{-i (\omega_0 t + \phi(\omega_0) - \phi'(\omega_0)\omega_0 + \theta)} + e^{i (\omega_0 t + \phi(\omega_0) - \phi'(\omega_0)\omega_0 + \theta)} \Big) \\
\\
&= |H(i\omega_0)| \ a(t) \ \cos\big(\omega_0 t + \phi(\omega_0) - \phi'(\omega_0)\omega_0 + \theta \big) \\
\end{align}$$
Now multiplying $\tilde{Y}(i\omega)$ by $e^{\phi'(\omega_0)\omega}$ causes, in the time domain, $\tilde{y}(t)$ to be advanced in time by $\phi'(\omega_0)$. So
$$\begin{align}
y(t) &= \tilde{y}\big(t+\phi'(\omega_0)\big) \\
\\
&= |H(i\omega_0)| \ a(t+\phi'(\omega_0)) \ \cos \big(\omega_0 (t+\phi'(\omega_0)) + \phi(\omega_0) - \phi'(\omega_0)\omega_0 + \theta \big) \\
\\
&= |H(i\omega_0)| \ a(t+\phi'(\omega_0)) \ \cos\big(\omega_0 t + \phi(\omega_0) + \theta \big) \\
\\
&= |H(i\omega_0)| \ a(t-\tau_\text{g}(\omega_0)) \ \cos\big(\omega_0 (t-\tau_\phi(\omega_0)) + \theta \big) \\
\end{align}$$
Where group delay $\tau_\text{g}(\omega)$ and phase delay $\tau_\phi(\omega)$ are defined as above.