General information on baggage handling:
When should I use a green Star Alliance “Transfer” flag on my airline bag tag? When should I put one in my bag tag?
When you feel like it or if it generally makes you feel happy. They serve no direct operational purpose mentioned in any IATA manual (obviously barring discretionary airport guidelines on baggage management systems).
Having said that, certain star alliance hubs have additional 360° scanners that recognize such tags if attached to the official baggage tag. I am not aware of any system that makes routing or sorting decisions based on this.
Are these tags used to identify bags that are transferring between Star Alliance airlines, or within the same airline, or something completely different?
They merely serve as visual hints, however all luggage handling has to run by LPN number (10 Digit License Plate). This number will provide a link to your itinerary in the BRS (Baggage Reconciliation System), which in turn will know your transfer route. It's imperative for baggage handling systems that luggage during transfer be not significantly faster nor slower than the passenger transfer time.
Star Alliance priority tags are sometimes recognized in baggage loading/unloading and sorting processes by certain star alliance hubs (mostly during solar eclipse). You might have seen those before: