tl;dr
Just run each script in a separate process.
Options for running withing the same process
There's a couple of things to look at. The first would be to put each script into it's own classLoader that has the Extensions ClassLoader or maybe even the Bootstrap classloader as it's parent. This is to control the groovy script's access to your application's classes.
Monitoring the execution time is easy. Just run each script in it's own thread and interrupt the thread if it goes over the 3 second limit. Keep in mind, though, that interrupting the thread simply raises an InterruptedException, which can be caught and handled within that thread. It's not easy to stop a thread if the code is designed to recover from those exceptions.
The memory part is where things really fall apart. This answer pretty much says everything that needs to be said about that - not possible. Somebody could easily run you out of heap space and crash the jvm.
Running in their own processes
Ultimately, I would really recommend just running each one in a separate process. There's a couple of benefits to this, not the least of which being that it's way easier to sandbox them by taking advantage of running them as a separate user. That way you can get another level of protection from the OS.
Also, if you want to pass exceptions back to the main java process, this can be done pretty easily because Exception implements Serializable. This means that you can easily send the Exception back to the main process over a SocketChannel, or by http, serializing to a file, or using whatever protocol you want. Take a look at this article for some basic info in Serialization.