It is possible to give a formal definition of the total order in terms of combinatorics on words (although it is merely a direct translation of the definition using the Magnus automorphism). It relies on the extension to words of the binomial coefficients (see below).
Let $A$ be a finite, totally ordered alphabet, for instance $A = \{a, b\}$ with $a < b$. Let $(x_n)_{n \geqslant 0}$ be the sequence of words of the free monoid $A^*$ (totally) ordered by the shortlex order: $$1 < a < b < aa < ab < ba < bb < aaa < \dotsm$$
Short answer. The free group $F(A)$ is totally (bi-)ordered by setting, for $u, v \in F(A)$, $u < v$ if and only if, there exists $n \geqslant 0$ such
that
$$
\text{$\binom{u}{x_k} = \binom{v}{x_k}$ for $0 \leqslant k < n$ and $\binom{u}{x_n} < \binom{v}{x_n}$}.
$$
Let me recall some useful definitions.
Shortlex order. The lexicographic order $\leqslant_{lex}$ on the free monoid $A^*$ is the order used in a dictionary. The shortlex order on $A^*$ is defined as follows. If $u, v \in A^*$, then $u \leqslant v$ if either $|u| < |v|$ or $|u| = |v|$ and $u \leqslant_{lex} v$.
Subword. A word $u$ is a subword of $v$ if $v$ can be written as
$v = v_0u_1v_1u_2v_2\dotsm u_kv_k$
where $u_i$ and $v_i$ are (possibly empty) words such that $u_1u_2\dotsm u_k = u$. For instance, the words $\color{red}{baba}$ and $\color{red}{acab}$ are subwords of $abcacbab$ since
$abcacbab = a\color{red}{b}c\color{red}{a}c\color{red}{ba}b = \color{red}{a}b\color{red}{ca}c\color{red}{b}ab$.
Binomial coefficients of words in $A^*$. Given two words $u$ and $v$, let $\binom{v}{u}$ denote the number of distinct ways to write $u$ as a subword of $v$.
More formally, if $u = a_1a_2 \cdots a_n$, then
$$
\binom{v}{u} = \left| \left\{ (v_0, \ldots,v_n) \mid v
= v_0a_1v_1 \ldots a_nv_n \right\} \right|.
$$
Observe that if $u$ is a letter $a$, then $\binom{v}{a}$ is simply the number of
occurrences of the letter $a$ in $v$. Also note
that if $A = \{a\}$, $u = a^n$ and $v = a^m$, then
$$
\binom{v}{u} = \binom{m}{n}
$$
and hence these numbers constitute a generalization of the classical
binomial coefficients. The generalized binomial coefficients can be iteratively computed using the following generalisation of Pascal's triangle. Let $1$ be the empty word. Let $u,v \in A^*$ and $a,b \in A$. Then
- $\binom{u}{1} = 1$,
- $\binom{u}{v} = 0$ if $|u| \leqslant |v|$ and $u \neq v$,
- $\binom{ua}{vb} = \begin{cases}
\binom{u}{vb} &\text{if $a\not= b$}\\
\binom{u}{vb} + \binom{u}{v} &\text{if $a= b$}
\end{cases}$
Binomial coefficients $\binom{v}{x}$ where $v \in F(A)$ and $x \in A^*$.
One can extend the "Pascal's triangle" by setting, for $v \in F(A)$, $x \in A^*$ and $a \in A$
$$
\binom{va^{-1}}{xa^{r}} = \sum_{0 \leq i < r} (-1)^i \binom{v}{xa^{r-i}} \text{
where $x$ does not end with an $a$.}
$$
For instance,
\begin{align*}
\binom{aba^{-1}b^{-1}}{aba} &= \binom{aba^{-1}}{aba} = \binom{ab}{aba} -
\binom{ab}{ab} = 0 - 1 = -1 \\
\binom{aba^{-1}b^{-1}}{baa} &= \binom{aba^{-1}}{baa}
= \binom{ab}{baa} - \binom{ab}{ba} + \binom{ab}{b} = 0 - 0 + 1 = 1
\end{align*}
Connection with the Magnus automorphism. Let ${\mathbb Z}\langle\!\langle A\rangle\!\rangle$ be the algebra of noncommutative power series with coefficients in $\mathbb Z$
and variables in $A$. The Magnus transformation is the monoid morphism $\mu$
from the free monoid $A^*$ to ${\mathbb Z}\langle\!\langle A\rangle\!\rangle$ defined, for each letter $a \in A$, by $\mu(a)
= 1 + a$. Then for each $u \in A^*$,
\begin{equation}
\mu(u) = \sum_{x \in A^*} \binom{u}{x} x
\end{equation}
For instance
\begin{align*}
\mu(abaa) &= (1+a)(1+b)(1+a)(1+a) \\
&= 1 + 3a + b + 2aa + ab + 2ba + aaa + 2aba + baa + abaa
\end{align*}
Since the series $1 + a$ are invertible in ${\mathbb Z}\langle\!\langle A\rangle\!\rangle$, the
Magnus transformation can be extended to a group homomorphism from $F(A)$ to ${\mathbb Z}\langle\!\langle A\rangle\!\rangle$.
For instance,
\begin{align*}
\mu(a^{-1}) &= (1+a)^{-1} = \sum_{n \geq 0} (-1)^n a^n \\
\mu(aba^{-1}b^{-1}) &= (1+a)(1+b)(1+a)^{-1}(1+b)^{-1} \\
&= (1+a+b+ab)\Bigl(\sum_{n \geqslant 0} (-1)^n a^n\Bigr) \Bigl(\sum_{n \geq 0} (-1)^n
b^n \Bigr) \\
&= 1 + ab - ba - aba - abb + baa + bab + \dotsm
\end{align*}
One can now define the binomial coefficient
$\binom{u}{x}$ for $u \in F(A)$ and $x \in A^*$ by setting
for each $u \in F(A)$,
\begin{equation}
\mu(u) = \sum_{x \in A^*} \binom{u}{x} x
\end{equation}
For instance, one recovers the values
$$
\binom{aba^{-1}b^{-1}}{aba} = -1 \qquad \binom{aba^{-1}b^{-1}}{baa} = 1.
$$