Many apps don't have a 'text selection' object in their scriptable dictionary, so you have to do all kinds of workarounds.
For very scriptable, text document based apps, there is much similarity, looking something like: tell app 'xyz' to get selection of document 1
To get the selected text of the front window in an app, Applescript has to use the language/syntax that this app understands/responds to. For Applescript, it works with other applications.