A diff finds the minimal set of changes (insertions and deletions) that transform one text into another. The classic algorithm — Myers diff, used by Git — finds the longest common subsequence (LCS) of the two texts, then marks everything not in the LCS as added or removed.
The output format you know from Git (+ for added, - for removed) is the unified diff format, standardized in POSIX. It's the same format used in patch files, pull requests, and code review tools.
A "changed" line is represented as a removal followed by an addition — diffs don't have a "modified" operation, only delete + insert pairs. Word-level diffing (intra-line highlighting) makes small changes easier to spot in long lines.
All comparison runs locally in your browser. Your text is never sent anywhere.