SessionSynchronization interface can be optionally implemented by a CMT Stateful Session bean. The 3 methods of this interface are container callback methods, meaning that the container will call these methods at the appropriate time during a transaction and execute any code you have written in them. These methods can be used to know the transaction boundaries for a CMT bean.
Below is an outline:
What functionality can be put into these 3 methods can be found in the spec on page 74. Also in HFE.