Digression, episode, excursus, divagation are comparable when they denote a departure from the main course of development, especially of a narrative, a drama, or an exposition.
Digression applies to a deviation, especially if at the expense of unity of effect, from the main subject of a discourse; it may or may not suggest intention or design.
Episode (see also OCCURRENCE) usually applies to an incidental narrative which, though separable from the main subject, arises naturally from it; sometimes an episode is definitely a purposeful digression (as for giving variety to the narration, heightening the illusion of reality, or elucidating a motive); thus, in Paradise Lost Raphael’s account of the war in heaven is in this sense an episode because it breaks the chronological order of the poem and reverts to events which occurred prior to those told in the first book.
Episode is used not only of a literary work but of other art forms or of life in reference to something that seems apart from the main subject or course of a thing.
Excursus applies to an avowed and usually formal digression elucidating at some length an incidental point.
Divagation is often used in preference to digression when aimless wandering from the main course or inattentiveness to logic is implied.