This is the best guide as to how to do it. The way the .htaccess file works is that any requests to non-existant files are redirected to WP (this includes all you WP pages, since they don't exist as physical files, rather as data in a db), so you have to tell WP what to do when it gets a request for a non existant page, which this does. (The server doesn't know what is a valid WP page and what isn't, it simply passes the requested address on to WP to decide what to do.)Hmmm see this about Wordpress 404: http://codex.wordpress.org/Creating_an_Error_404_Page
If I'm not mistaken, the Wordpress Permalink Rewrite Rules prevent Custom Error Pages from working because Wordpress already has a built in Error page (theme's 404.php). The ErrorDocument and RewriteRules .htaccess lines conflict each other.