Theoretically, you can store the text prior to the change in a variable, and then when the text changes, compare the two strings and calculate the differences. From what I can tell based on Google searches, this should be doable, though there does not appear to be a GDScript version implemented. I would look for Python versions and see if you can find one that you can convert/port to GDScript, and then use that.
If you are okay with using C#, then there are several options that look viable when searching "C# get difference between two strings" in a search engine like Google.