It's in the 401(k) regs.
QUOTE
1.401(k)-1(f)(3) Separate accounting required. --Under the separate accounting requirement of this paragraph (f)(3), contributions and withdrawals of designated Roth contributions must be credited and debited to a designated Roth account maintained for the employee and the plan must maintain a record of the employee's investment in the contract (that is, designated Roth contributions that have not been distributed) with respect to the employee's designated Roth account. In addition, gains, losses, and other credits or charges must be separately allocated on a reasonable and consistent basis to the designated Roth account and other accounts under the plan. However, forfeitures may not be allocated to the designated Roth account and no contributions other than designated Roth contributions and rollover contributions described in section 402A(c)(3)(B) may be allocated to such account. The separate accounting requirement applies at the time the designated Roth contribution is contributed to the plan and must continue to apply until the designated Roth account is completely distributed. See A-13 of §1.402A-1 for additional requirements for separate accounting.