Programmatically pass arguments to grunt task?

I figured it out. Use the <%= %> syntax in Gruntfile.js:

compass: {
  default_options: {
    src: 'components/<%= myTask.src %>',
    dest: 'build',
    require: ['zurb-foundation']
  }
}

Then you can set it in your task:

grunt.config.set('myTask.src', getSrc());

You can edit all the Grunt config:

grunt.config('compass.default_options.src', 'blabla');

Just before run the task. But your solution is "cleaner".