BTW, how is this implemented?
Did you modify the transaction format or did you just add the capability this an option to scripting?
The transaction format was modified, while trying to keep it backwards compatible.
If a transaction does not have a comment, it is the "normal" version 1 transaction structure. If it does have a comment, a new version 2 transaction structure is used, which is the same as the version 1 structure, except for a variable length comment at the end.
The 140 character limit is arbitrary and can be changed in future without changing the transaction structure.