Q:

Is there grunt plugin for wrapping code into Self-Executing Anonymous Functions like in BackboneJS?

I have sone javascript code that I need to overlap into Self-Executing Anonymous Functions like BackboneJS does:
(function(root, factory) {

    // Set up Backbone appropriately for the environment. Start with AMD.
    if (typeof define === 'function' && define.amd) {
       define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
       // Export global even in AMD case in case this script is loaded with
       // others that may still expect a global Backbone.
       root.Backbone = factory(root, exports, _, $);
    });

    // Next for Node.js or CommonJS. jQuery may not be needed as a module.
    } else if (typeof exports !== 'undefined') {
        var _ = require('underscore');
        factory(root, exports, _);

        // Finally, as a browser global.
    } else {
        root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
    }

 }(this, function(root, Backbone, _, $) {

A:

The answer is yes, 
if you want to divide the file into pieces and then after concatenation have it inside function like this
(function(){
 // file 1 content
 // file 2 content 
})();

You need  grunt.loadNpmTasks('grunt-contrib-concat');
and define  the banner and footer: 
concat: {   
      app: {
        options: {
          separator: ';\n',
          banner: '(function(){\n',
          footer: '\n})();'
        },

        src: [
        'src/*.js'
        ],
        dest: 'app.js'
      }
    },

