Best use of RAM for multiple SQL instances?
You can allocate maximum amounts of memory that each SQL Server instance can use through the sp_configure stored procedure.  However, that won't be an absolute maximum, but a maximum amount of memory allocated to the storage of certain types of data, mainly data cached from the database.

If you're planning on running one instance of each version of SQL Server since 2008, you're looking at five instances of SQL Server on a 32MB server; you'll need to leave a few GB RAM available for the operating system and anything else on that server (SSIS?  SSRS?  SSAS?).  At a conservative estimate, you'll probably only have about 4GB RAM available for each instance, so you would run something like:

exec sp_configure 'show advanced options', 1;  -- ensure memory configuration option is available 
GO  
RECONFIGURE;  
GO  
exec sp_configure 'max server memory', 4096; -- maximum memory in MB 
GO  
RECONFIGURE;  
GO  


Note that difference versions of SQL Server interpret the configuration setting in different ways - more recent versions apply the setting to more types of memory allocation.  There's a table about half way down this sizing consideration document that shows what's changed.